package com.ruoyi.resturant.service.impl;

import com.ruoyi.resturant.domain.Student;
import com.ruoyi.resturant.mapper.StudentMapper;
import com.ruoyi.resturant.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements IStudentService {

    //Autowired注解，在接口实现类中，使用该注解，可以自动注入接口对应的实现类,就是不用New
    @Autowired
    private StudentMapper studentMapper;

    public List<Student> getStudents(){

        List<Student> students = studentMapper.queryAll();
        return  students;
    }

    @Override
    public Student selectStudentById(Long id) {
        return studentMapper.selectStudentById(id);
    }

    @Override
    public int insertStudent(Student student) {
        return studentMapper.insertStudent(student);
    }

    @Override
    public int updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    @Override
    public int deleteStudentById(Long id) {
        return studentMapper.deleteStudentById(id);
    }


}
